/***************************************************************************************************
  Copyright(C)   2011-9-13
  All rights reserved.
  File Name: moduleplay.h

  Description:　播放模块，里面包含好几个部件，如果视频播放，文字显示，图片等

        一个播放布局就是同时包含好几个播放模块


  ***************************************************************************************************/

#ifndef MODULEPLAY_H
#define MODULEPLAY_H

#include <QTimer>
#include <QDebug>
#include <QTextCodec>

#include "public/environment.h"
#include "pictureviewer/pixplaylabel.h"
#include "flashplayer/flashplayer.h"
#include "configclass.h"
#include "medialist.h"
#include "bulletinlist.h"

#ifdef PDFVIEWER
#include "pdfviewer/pdfviewer.h"
#endif

typedef QList<PixPlayLabel*>  PicList;
typedef QList<medialist*>     MediaList;
typedef QList<bulletinlist*>  BulletinList;
typedef QList<FlashPlayer*>   FLASHPLAYLIST;

class ModulePlay : public QObject
{
    Q_OBJECT
public:
    ModulePlay(QObject *parent = 0);
    ~ModulePlay();

    void hide();
    void show();
    void stop();
    void updateRoutePkg(const RoutePkgStruct& routePkgStruct);

    int getCurPlayType() const;
    int getCurPartitiionID() const;

    void play();


    void startToUpdata(const QString& msg);
    void updateDataState(const QString& msg);

    void seekToTimePos(const float seconds);
    void getCurTimePos();


private:
//    PicList                 m_picList;
//    MediaList               m_mediaList;
//    BulletinList            m_bulletinList;

    PixPlayLabel*           m_pixLabel;
    medialist*              m_mediaList;
    bulletinlist*           m_bulletin;
    FlashPlayer*            m_flashPlayer;

#ifdef PDFVIEWER
    PdfViewer*              m_pdfViewer;
#endif



    LayoutStruct            m_layoutStruct;                 //布局结构体
    QList<ContentStruct >   m_cntList;
    QTimer*                 m_playTimer;                    //播放定时器


    int                     m_curPlayType;                  //当前正在播放类型
    int                     m_nCur;                         //当前播放序号
    bool                    m_onlyPlayUnlimited;
    QTimer*                 m_bufferTimer;

signals:
    void mplayerTimePos(const float seconds, const int partitionID);
    void playAllFinish(const int partitionID);

private:
    void init();

private slots:
    void PlayToNext();
    void flashLoadFinish();
    void toHideOther();

    void updateConfig();

    void receTimePos(const float seconds);

    void mediaPlayEnd();


};

#endif // MODULEPLAY_H
